package carmensd.vista.expedienteYvillanos

import applicationModel.ExpedienteAppModel
import org.uqbar.arena.windows.WindowOwner
import org.uqbar.arena.widgets.Panel
import applicationModel.VillanoAppModel
import org.uqbar.arena.widgets.Button
import modelo.Villano

class ExpedienteAdministradorWindow extends ExpedienteMainWindow {

	new(WindowOwner parent, ExpedienteAppModel expedienteAppModel) {
		super(parent, expedienteAppModel)
	}

	override createContents(Panel expedientePanel) {
		super.createContents(expedientePanel)
		this.setTitle("Expedientes")

		new Button(expedientePanel) => [
			caption = "Nuevo"
			onClick [ |
				this.openDialog(new NuevoVillanoWindow(this, new VillanoAppModel(modelObject.expediente, new Villano)))
			]
		]

		/* Boton de Editar el villano seleccionado */
		new Button(expedientePanel) => [
			caption = "Editar"
			onClick [|this.openDialog(new EditarVillanoWindow(this, new VillanoAppModel(modelObject.expediente, modelObject.villanoSeleccionado)))]
		]

	}
}
